#/bin/bash

TRAPEXIT() {
    if [[ ! -o login ]]; then
        if [ -e "~/.zlogout" ]; then
            . ~/.zlogout
        fi
    fi
}
export HISTCONTROL=ignoreboth

if [ -x /usr/bin/dircolors ] ; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi

# pip install会安装到~/.local/bin
export PATH=/usr/sbin:~/bin:~/.local/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./

# 获取 pip 源地址，只有在 pip 存在且成功获取时才设置 UV_INDEX_URL
if command -v pip &> /dev/null; then
    PIP_INDEX_URL=$(pip config get global.index-url 2>/dev/null)
    if [ $? -eq 0 ] && [ -n "$PIP_INDEX_URL" ]; then
        export UV_INDEX_URL=$PIP_INDEX_URL
    fi
fi

TERM=xterm-256color
ulimit -c unlimited #for coredump

if command -v thefuck &> /dev/null
then
    eval $(thefuck --alias)
fi

